Condition inputs in one function