added if to input handler