Clean up code

Clean up code.
Group tests that result in the same outcome.