Convert directory and page to objects rather then dictionaries