minor refactoring + reformatting, just so that it is visible in the big diff and I can comment on it