added some usage documentation
slight refactoring and some comments