reformatted to match original code