implemented main, added v2 and v3