Changed lists to vectors for efficiency