Code Revamp

Totally reworked the code. Incorporated a switch statement to handle
sensor states. Also added a flag to help better control when the sensors
increment/decrement the ppl_in and ppl_out variables