add documentation and comments