Clean up code style. Update tests.