Refactoring messages, adding a web api