unit tests extended, small refactor