SOAP-1416 Improved error messages + refactoring