Added condition to function sprint 2