cache features and some refactoring