Refactor master password modal