fix a bug in session.isEnded
Try moving packet handlers to separate file - couldn't because of dmd bug.
Fix tabs.
Refactoring