improved unit test and added benchmark func