More fixes after actually testing the code with real analysis.