solution to #6