refactoring & unittest partial update