package rearrange and a few corrections