Perform a large overhaul on code