refactored sync scripts to use sqlwrapper class