Probably not what you were looking for...

...but the first thing I saw was the boolean constructor argument and I didn't like it :)

Not sure this is the best fix for it, but you get the idea.

Everything else looks good to me.