Optimize

- [ ] @EEE3 please sanity test

- some minor code cleanup 
- code to log more hard to repo edge cases
- more automation