adding sqlite logic