Refactor to extend framework