add some missing bits and do some clean up
implement session handling
define default parameters