Add WebIDL API; some clean up.