- Add asserts() to many cases where we blindly assume values to be correct
- Don't assume datatype of matrix elements to be int blindly in size computations. Instead use the actual sizeof() the elements.