move model (and sqlite) into its own class