prune method added and missing values handled