Changed dimension code. Seem to be getting some oob errors.