Added functionality to the home page to dynamically create pages based on data in the database.

Also added some comments for things that might not have been very obvious