Cleaning up code for packaging