Restructure database and sync class