Added matrix data structure and refactored array centering (see #49)