Clean up. Added a little more doumentation.