UIV-904 moved all logic from tpl's to preprocessor