Refactor: Replace array with std::vector