Replace deprecated query method with querySelector