added main function but bugs