changed the main function