cleanup and tests