First version.

More changes to be added later.