Fixed incorrect doctype serialization
Updates/fixes to session management
More session change/simplification