fixed issue on index.php where links to pages were incorrect when viewing a subject. Minor fixes are still in progress in functions.php.