Refactor to use expect