refactor in preparation of local variables

local variables require a second json root; this refactoring makes
sure we can basically use common functions for json handling
milestone: basic local variable functionality available

but some nits, like do not work with disk queues
make local vars work together with disk queues
Merge branch 'master-localvars'