Slowly cleaning up code