Updated with latest code from the google code