Re-factored a bit.