In this paper we extend the existing literature on xVA along three directions. First, we enhance current BSDE-based xVA frameworks to include initial margin by following the approach of Crépey (2015a) and Crépey (2015b). Next, we solve the consistency problem that arises when the frontoffice desk of the bank uses trade-specific discount curves that differ from the discount curve adopted by the xVA desk. Finally, we address the existence of multiple aggregation levels for contingent claims in the portfolio between the bank and the counterparty, providing suitable extensions of our proposed single-claim xVA framework.2010 Mathematics Subject Classification. 91G30, 91B24, 91B70. JEL Classification E43, G12.