Pages now loading. Some refactoring and layout fixes