Merge v2 and some updating.

Merge the v2 branch from @romancortes