diff --git a/mediawikifs.scm b/mediawikifs.scm
index c081981539784c08a09e50c0b8b9279c835e659c..865cde44344679b4f7c18ce445fbcad872783548 100644
--- a/mediawikifs.scm
+++ b/mediawikifs.scm
@@ -76,6 +76,7 @@
                  '()))))
 
 
+;; returns string list of all categories
 (define (all-categories #!optional continue-from)
   (let* ((page _ _ (get-xml-page (category-uri continue-from))))
     (append (map sxml:text ((sxpath '(// allcategories c)) page))
@@ -95,6 +96,7 @@
                  `((cmcontinue . ,continue-from))
                  '()))))
 
+;; Get string list of pages belonging to category
 (define (all-pages-in-category category-name #!optional continue-from)
   (let* ((page _ _ (get-xml-page (category-members-uri
                                   category-name continue-from))))
@@ -125,9 +127,10 @@
                     (map (cut cons <> 'not-downloaded)
                          (all-categories))))
 
+;; wrapper around `all-pages-in-category', which also updates hash-map
 (define (category-page-names category)
   (case (hash-table-ref/default categories category 'no-such-page)
-    ((no-such-page) '())
+    ((no-such-page) #f)
     ((not-downloaded)
      (let ((pages (all-pages-in-category category)))
        (set! (hash-table-ref categories category) pages)
@@ -136,10 +139,12 @@
 
 (define pages (make-hash-table))
 
+;; Get id field of page object
 (define (page-id page)
   (let ((id-str (sxml:text ((sxpath '(// mw:page mw:id)) page))))
     (read (open-input-string id-str))))
 
+;; Get byte length field of page object
 (define (page-length page)
   (let ((length-str (sxml:text ((sxpath '(// mw:page // mw:text @ bytes)) page))))
     (read (open-input-string length-str))))
@@ -159,9 +164,9 @@
               (let ((path (string-split path-str "/")))
                (cons* "." ".."
                       (map ->string
-                       (cond ((null? path) (hash-table-keys categories))
-                             ((= 1 (length path)) (category-page-names (car path)))
-                             (else '()))))))
+                       (cond [(null? path) (hash-table-keys categories)]
+                             [(= 1 (length path)) (category-page-names (car path))]
+                             [else '()])))))
 
    getattr: (lambda (path-str)
               (print path-str)
@@ -174,17 +179,17 @@
                           (current-group-id)
                           (hash-table-size categories)
                           0 0 0))
+
                  ((= 1 (length path))
                   (let ((sub-pages (category-page-names (car path))))
-                    (if (null? sub-pages)
-                        (vector (bitwise-ior file/dir #o555)
-                                2 0 0 0 0 0 0)
-                        (vector (bitwise-ior file/dir #o555)
-                                2
-                                (current-user-id)
-                                (current-group-id)
-                                (length sub-pages)
-                                0 0 0))))
+                    (and sub-pages
+                         (vector (bitwise-ior file/dir #o555)
+                                 2
+                                 (current-user-id)
+                                 (current-group-id)
+                                 (length sub-pages)
+                                 0 0 0))))
+
                  (else
                   (let* ((page (get-page pages (cadr path))))
                     (and page
@@ -200,6 +205,7 @@
                    (else (get-page pages (cadr path))))))
 
    read: (lambda (handle size offset)
+           ;; TODO handle size and offset
            (sxml:text
             ((sxpath '(// mw:page // mw:text)) handle)))
    ))