simplified input handler (thx to dingo for the initial idea)