Reduced the amount of stuff in main()