Refactoring and fixing broken passwordPeek setting.
Fixed issues with passwordPeek setting, created a test for it and refactored the code.