Use list instead of vector. It works better.