moved phase_cache to its own file