tests, small code cleanup