Refactor with pointer vector