errors correction + refactor begin test