refactored and dried up tests