refactor structure of foundation files