Replaced flatfile input with the sqlite database