Clean up code a bit.
Document a bit