Minor code cleanup in 3d viewer (remove dead or useless code). Some minor other fixes.