-dependency-based reording added to final step in solver
-fixed bug to do with "~foo" type statement