Minor code readability improvements and added brackets to "if" statements per PSR-2:5.1: http://www.php-fig.org/psr/psr-2/