adding function snippet