start refactoring message-handling (crashes)