added collision detection
fixed a few issues