Merge pull request #316 from sambaek/master

more lib/ clean up and documentation
add changes that were made in #319