@UKHeliBob, thank you so much that was exactly my problem. I'm used to MATLAB, and I didn't even consider that my math language may be wrong.
@PaulS, thank you as well. I've incorporated arrays into my code and it is much more manageable, and organized.
Thanks guys!