completed with bugs.  while loop continues to execute even when the condition is met.