PLF-5811: Improved the code