Some ugly templates. Almost functional