Improved Input Handling