Minor cleanup and add a test