Changed to using classes. Added helper function for concatenating character matrices.