slightly modified?

seems functional