Basic doc and little refactoring