prepared for data subsets
prepared for data subsets + bug fix: NA handling