Changed new page logic, added testing function for newdirectory