Cleaned up a little more and added documentation.