Collision detection implemented with a few issues.