Improved fragment building algorithm optimised for pileup handling