Upgraded to v2 and ported changes from fork