Some template optimization
More tests and bencmarks