Can have crashing if bad data makes into into here, might be useful to have some sanity checking here