moved types declarations to types.js, and created idioms.js with the same intended purpose of api.js but re-thinked
wrote API for groups too, and moved some implementation logic to idioms.js