Minor chain refactorings. Added perf test for chain