Added collision detection support for upper and lower height