Implemented SQLite controller and did some refactoring...