Finished sorting, ordering and SQLite integration

Finished sorting, ordering and SQLite integration