Re-factored a little.