A little refactoring, a little testing, a little documentation.