Various cleanup

No functional changes just refactoring