Refactor Collision.js and many more bugfixes