refactoring into a flux app