code, cleanup comments. This version is more or less in line with the one that i submitted to the asterisk developers.