added sumofbottom and gravity