Re-factored for loops.