don't unlock based on empty session
refactored dwpage.php to new CLI
code reformat