Rework JID parsing

Fixes #49