clean up coding style and remove explicit temporary variable