mod: check returned values, cleanup
mod: removed useless array comparison