pull out a dedicated piece of logic into a private method