Cleaning up the codes