Add input operator
Improve error handling