Fixed subtle bugs. What a pain in the ass
Removed unnecessary classes and functions, refactored