cleanup of common code