cleaned up some codes