chore(style): convert blocks into functions (see #325)