Bugfix, optimization, and an idiom

Hey just adding a few bits for great good.  Feel free to merge or deny!

Jason