Began refactoring to pull out functionality now that the DB is working