algorithm setup