more stable input code