code is now using vecmath