Refactoring commit 92a15e into matt-db-sync-2