little refactoring, cleaning up, documentation.