Added author's solution