Move reusable functions to a seprate mathlib