Added navigation <ul>, a bit of error handling,
moved database connections into session lifetime