Have renamed sync.php to process.php because this is a process step and not a synchronisation step.
Fix bug: queries not constructed correctly now that variables are being escaped.