complete bouncing box functionality