Fix copy_matrix, and set up basic command functionality.