PSGI ready
code cleanup
session functionality implemented