Math code refactors and some path changes