Credit Victor Granic for enhancement to wpdb-move