Refactor reading sync and async messages