Added if statement and basic test coverage