Refacored code.