ex9 solution (super shitty)