Refactored package structure, added initialization type check