Added logic for getting a Box index from a line.