some refactor in tests and subs