first stab at template functions with session data

This should be a good basis for #3.