Cleaned up the codes