Add a bunch of filesystem stuff

This is a massive rebase.