setup program structure and functions