     ] [ drop ] if ;
 
  : gemini-ls ( args -- )
-    PAGE swap "-l" = '[
-        1 + swap first2 swap
-        _ [ " (" ")" surround ] [ drop f ] if
-        "[%d] %s%s\n" printf
-    ] each-index
-    LINKS delete-all PAGE keys LINKS push-all ;
+    [ PAGE ] [ "-l" = ] bi* print-links ;
 
 : gemini-quit ( -- )
     "gemini.txt" temp-file ?delete-file 0 exit ;

        0 swap remove-nth!
    ] when dupd remove! push ;

: gemini-history ( -- )
    HISTORY [ 1 + swap "[%d] %s\n" printf ] each-index
    LINKS delete-all HISTORY LINKS push-all ;

: gemini-print ( url body meta -- )
    f pre [

                    ] when
                ] if
            ] [
                2drop
                STACK push
            ] if
        ] [
            drop
            STACK delete-all
            STACK push
        ] if*
