Merge classes and overhaul entire code