refact the code, add pbc to benchmark tests
add tests