changing return value and echoing making it easier to test