crude session implemented, moved calls in preperation for zlib