Fixing main function