tailalgorithm1 applied and working fine. starting on tailalgorithm2 now