refactoring, developing more flexible framework