Untangle the code a little.