code snippets for Ray