Use SQLiteDataProvider and some refactoring