documentation drive and a little refactoring