more working tests - more refactoring