Refactoring (and adopt docco)