Made appendTo accepts functions