Made changes to query and getElement functions.