change getelements to queryselrctor to reduce code