Refactored everything to accept a generic Vector.