move shared funcs to util
move code to javarosa plugin