refactor createSession to use a prototypical constructor

Lots of session objects are created, and they are likely to leak. Using
a named constructor makes memory leaks a lot easier to find. They are
also faster to instantiate and use less memory
add returns to avoid creating meaningless comprehensions
recompile server