more functions and templates