modified rbf coding slightly to take variable std