Bug fixes and cleanup for arrays implementation

Fixed bugs relating to match array updating and setting X,Y for priors
matrix. Did some general code cleanup. Passes smallTest