had a lot of help from hints, but added some comments to help guide me through it all