Same comment as above. It might be shorter to just assign an empty array to titles here, drop every ```titles = titles || []``` occurence and just put a check at the end which assigns ```null``` to titles if the array length is 0.