Add exception handling (#3)