Changed error handling to use hierarchy of exceptions.
Added Options classes instead of Map<String,String>.