added depency injection and set the doucment as a service