Case statements and refactoring of directory_pro