Reorganized some aux. code.