Mm, I am sure you are right, here we have some potions of duplicated code. But this solution is somehow straight forward and most important it is working well. So I am not in favor to touch it now.