Light refactoring of tonight's code, add comments