improved input processing