changed query to privs and syntax return without if
added url rewrites
Merge branch 'dev'