Refactored some method.