added check for rectangularity, fixed bug in initializer, refactored