Also, may want to add a check here that N is not 0.