Added option to add to the beginning or the list