Added style queue to prevent multiple reflows during layout. Added randomize option to sorting.

Other general improvements.