package refractor and cleanup