forgot to commit it in pull request
code cleanup and documentation
fixed tests