Re-factored code.