sqllite and major refactorings.