refactored a bit
move the URI templates handling into a seprate utility class