changed if statement structure