Updated for compatibility with MPLAB XC8 compiler