Refactor expect code
Expose async as parameter for expect