Simlify and optimze slow sloppy code.
Simlify and optimze slow sloppy code.

AmeBel/atomspace,rTreutlein/atomspace,AmeBel/atomspace,rTreutlein/atomspace,AmeBel/atomspace,rTreutlein/atomspace,rTreutlein/atomspace,rTreutlein/atomspace,AmeBel/atomspace,AmeBel/atomspace