More critical updates

After processing more samples of different types, I cam across a few
more instances were a zero, or null value was causing problems. (Also,
thoroughly fed up with how I wrote this in such a bulky way. Really need
to start writing concise functions and loops from here on out)