Eng5715

First commit is just code cleanup, the second is the fix.