Created the condition logic