Cool function. I didn't know about sapply. Could you remove lines 51-64 and 69-82 and include the output?