Substantially reworked to use strings instead of large sequences.