Fixed Refactor
Moved trivial, linear solutions to local variables
Fixed indentation
Further simplifications
Fixed Analyze

This bug caused weeks of headaches...
A whole commit just for that...