changed javascript to append