Standardize sequence handling and add support for sets