Refactoring: apps state