Better version of subsetting routine.