move function calls to main()