started refactoring for extension