[PAXURL-242] removed unnecessary typecasts
[PAXURL-242] removed duplicate code