ugly, functional template