added wall collision detection