Modified code added main