Implementing concatenate_matrices method, bugfix