Added password_query function