Refactored code for 2012 syntax standards.