refactored to use flux architecture