Cleaned up some of the codes