Documentation and code clean up