applied parts of "anonymous" cleanup patch.