Pseudo coding through comments to get some feedback from @sipple to see where I should go next with this.