Remote parsing

Fixes #193 and tidy-ups inspired by #193.