reusing some old math/vec code