Pulled out modular exp into its own file