documentation and code clean up