s/mkdir/filelib/; several refactorings