refactored initialization to ensure parameters are properly handled