improved initial logic