Updated error handling, particularly for password rules parsing failures
Some refactoring