first run logic