implemented most of the business logic and integrated with sqlite.