refactor vector and smp function