use splitlines() instead of splitting at newlines