Some refactor and benchmarks