First crack at stomping out race conditions and making the code more robust.
Remove trailing whitespace.
Hopefully this will correct the last remaining race condition.
Fix syntax error.
Kill one more race condition.
Fix bug in pop.
Simplify.
SSttoopp SSttuutttteerriinngg..