Original version (minor changes).