newpage changes
Better dir handling