Performs some cleanup in the code