CONN-1161 & CONN-729

Resolved more issues found during QA of CONN-1161 and CONN-729, and a bit more code cleanup.