added 'else' statement for conditions.