Fixed collision bug and drastically optimized code.