refactoring some correction