Implementing file listing in tree.rb is harder than I anticipated