Refactoring into flux architecture