Changed Matrices to handle Double instead of int