Some refactoring before adding Room support