Slightly improved version.