Slightly improved code.