Tiny refactoring, better comments, corrected author.