Added simple logic to program for ion directions
debuging program