changed if statement to unless