Added check to ensure the first index can never be negative