Replaced factories by depenency injection and service configuration