math is nearly done, just needs the endPoint cases, see phone notes
math is nearly done, one last error and then corner logic