changed helper functions to lambdas, added test for auto-template