clean up, bring it in line with reality, add some comments