Refactor make input handler anonymous