update: tests
refactoring code