Moved utility functions into their own class and added message type constants