Major revision v3 and tests