New getElements function