refactor of extension