Move math stuff to plugins