Modified functions to handle vectors