added coded for subset3 but found bugs for subset2