functional code with scene graph