misc alignment packing refactoring and bug fixes