Changed an if else statement an add reasons to the log