reorganizing a bit
-1 replaces NA
some cleanup