Added if..else around session.write.
Renamed core.wsgi to wsgi.
Serializer cleanup.
Code refactoring.