Refactor class methods into private functions