Issue #271 beautify the code and documentation