snippet based on tbjs