Cleaned up some codes