Refactor janky sequence splitting code