Unit test coverage and DRY up code