added a small (not so idiomatic...) routine to parse post parameters