See updated PR. I've added 2 more tests; feel free to give me feedback.