working basic collision detection