Refactor & blank password fix