Fixes #123 using tjmb's diff