The code inside the ``if`` looks like was pasted from Java :)

Could be changed in a for-comphresion + Option (I don't feel strongly about this, just saying).