schemes refactoring