correcting method name
cleanup
NPE fix and take generic samples into consideration