cleanup of code and dependencies and added tests