Refactoring SQLite