chaged main functionality