Cleaned up the code, created new classes and fixed some bugs
Bugfixes