I made this problem harder than it needed to be...