Changed position of main function