Make some cosmetic changes

get rid of some redundant parentheses and use specific library
functions or conveniences when appropriate