Added missing each keyword
Added protected
Cleaned up code
Added missing each keyword