refactor vecmath