added sqlite function and write to DB ability