Re-organized code and fixed collision (kinda)