added logic for smaller refEl