Refactor to match the docs