updated snippet code