I tried what you told me and so far it really lessened the problems,
unfortunately, the looping statement which increments and decrements both sides are having problems. once the side increments or decrements once it passes the 1st and last side, it wont be able to check them again.
Example...