code clean up, documentation