try to add a faster function but it has bugs