Improved documentation and little refactor