more refactoring, packaging