some refactoring of apps