Added solution to #8.