Better generator.

The generator now checks the client_id validity before it gets submited.
It also alert the user if the client_id is already taken.
Refactoring of the methods to be simpler.