refactor of database and adding scoring updates to use scores properly