added templated functions