moved code for handling wall side of slope for MM engine