updated Program 3