More modifications

I had to do a few things to get it running, but now it seems to be near
the optimal code, the last piece is how to keep the loop from ignoring
if conditions.
At current it ignores all if conditions I have given it.
Before and after the while loop was implemented.
Once I find a way to make it swap folders when limit is hit, the program
should be ready for polishing.
Other than that I replaced some parts with much more convenient ones and
with some re-thought logic was applied.