tested with more examples. it looks good. error codes are not too bad