refactored more code into new classes and stuff