added server side stage 2 code - not tested