Some small refactor and format