refs #8: code cleanup and comments