Padding extra space at the endpoint where blowup takes place. Also optimizing some code.