Changed database structure and manager to work with sqlite.