Reordering and bug fixes.