Changed database repo to use dependancy injection