Refactor creation of public/ directories