Cleaning up some codes