refactoring with better vector conversions
refactoring