The logic to clear a:lines and replace it with the return of the function failed pretty miserably when the function returned a:lines. It cleared a:lines and then replaced it with the (now empty) elements.