cleaned up the source code and took out commented functions and added comments to make it look better for submission