Added algorithms to insert for table and layered tags