Partially cleaning up code