improve error handling and styling