Replace vector copying with lookup