Fixed repacking

Code cleanup