add functional tests and corrct some issues #54
cleanup unused code and some refactoring
review crud tests