Finally got time to go back and finish this challenge. The code isn't very pretty but it does what it needs.