Clean up code hopefully nothing explodes