Finished with Jeremy's suggested solution