A little refactor, documentation