add graham's solution: