Re-factored for cleanliness