unified input handling