not working version, starting to add local db support