Applying tested ternary fix to endTime