optimize if-clause