password reset working but needs refactoring