Minor cleanup and tests