Fix theme selection issue, reduce duplication of calls and update maintenance.php to V3.