using splitlines method instead of split