Updated password changing function