changed if else construction