improved custom input handling