Improved slightly, and added comments