Horrible code. Tests passing but went down the wrong path.