Refactor expect syntax