Code clean up and documentation updates