added main scala code