more documentation and removed code cruft