init code from googlecode.