BUG :ERROR  in main for(.....) chaged to if (....)
minor corrections