refactor (show pure code, for better exposition)