Rewrite of filesystem code