Added variance sorting and threshold