added new test, refactor class