some code format stuff, minor refactors