Rearranging for clarity
Add comments
Remove debugging print statement