Refactors to avoid warnings from return.