Simplified function

Removed several unnecessary statements (and one variable) for one
single statement.