Changed code to fix logic errors, program works 100% now.