Refactor to use logical instead of physical Gpio states.
Beautify code.