refactor f0 into separate files