Bonus tests pass, but this could definitely use some refactoring.