General cleanup of code

- Making thins a little more polished, no major changes.
- Extensive testing of detecting numeric stability for solutions.