sqlite helper rewritten