Linked and threaded loops in proteins