Cleaned up solution 6 and simplified testing.