add bouncing logic