Change code to be more readable.
Add tests for service error parsing.