make if else more logical