bug#16895: active close button, and code cleanup