made solution to #8 not crappy