refactoring to latest changes in refinery core