Simplified code
Added comment