Code consistency fixes

This branch is the reroll of http://drupal.org/node/1947698