Final code-- cleaned it up