tweak some stuff and add session middleware