Organized code into functions that will be included in all files. Fixed page not found error