Moved message handling to it's own class