added functionality for inserting a list