Fixed password change with workaround; minor refactoring