Revising the code before TLP 2k13, I found a couple of things I could improve. Hope nothing got disturbed on the way.