refactoring
updated tests