Complete flux refactor