Argh, forgot to test before committing. One .append() should be .extend().