First pass at cleanup and optimizer

- Removed dead code
+ Added constant folding optimizer
+ Added static conditional optimizer