works properly for the small dataset, needs more test