Implemented some read out of bounds protection... which hopefully works as intended and doesn't break too much