INTRODUCTION: This study evaluates enhancements introduced in version 4.0 of Brainlab's Pencil Beam algorithm within the Elements treatment planning system (TPS) for radiotherapy dose calculations. These updates include a new scatter model to improve dose calculation accuracy and updated commissioning recommendations involving asynchronous sweeping gap (a-SG) measurements to refine multileaf collimator (MLC) parameters such as dynamic leaf shift (DLS) and tongue-and-groove (TG) size. MATERIALS AND METHODS: The original (version 3.0) and updated (version 4.0) implementations of the Pencil Beam algorithm were compared using a Varian TrueBeam STx accelerator with 6-MV flattening filter-free energy and high-definition MLC. Dosimetric accuracy was assessed through phantom-based point dose and volumetric measurements for clinical cases, including treatments for single and multiple brain metastases with volumetric modulated arc therapy (VMAT) and dynamic conformal arcs (DCA). RESULTS: The updated algorithm demonstrated superior performance compared to the original version. Point dose measurements showed a reduction in discrepancies between calculated and measured doses, with improvements of up to 2.1 % for smaller targets. Volumetric measurements revealed increased gamma pass rates, with improvements of up to 15.9 % at a 95 % dose threshold in VMAT and DCA treatments. CONCLUSION: These findings highlight advancements in dose calculation accuracy, particularly for small fields and multiple targets. These improvements of the Pencil Beam algorithm, driven by the scatter model and enhanced MLC parameter commissioning, contribute to more reliable dose predictions. As findings are specific to the 6-MV FFF beam and TrueBeam STx system, further investigations are needed for other energies and linear accelerators.