refactored beginning()