refactor to an extension