fix password hash and group issues; refactor, code style, improve documentation