Foundation refactor