more refactoring and cleanup in message sample