Cleaned up code. This is terrible OOP but hopefully the c++ gods will forgive me