removed c like hackery, moved to template