Update function snippet
refatoring