Code to attempt to split desired jam and displayed jam. Crashes firefox in a most spectacular way