Refactor benchmark and test