added logging to file, moved to main()