Deleted unuseful code from main program loop