Some code optimization according to Paul's suggestion