Added comments, cleaned up indents, and added log partial