Created method to splitlines and removed from the click event handler
Moved the functionality of converting the array of strings into an array of objects to a method