Improve error handling and user interface