cleaned up the codes