Simulator: cleanup

- Fix all compiler warnings
- Break statistics stuff into a separate file