updated #8 solution to use external file