Some training tweaking and simplifying of code. Safety/sanity check for returned values below zero.