Version similar to the one in the notes