Refactord code.