brushing up code for sqlite