preparation for unit tests; refactor