Replaced each with select
Replaced if with unless