Moved from c arrays to vectors for easier memory management