refactoring + small test (some things is not work correct!)