my refactor of your code, along with a few comments for next steps