Fixed bug in while loop that was causing an infinite loop.
Removed debugger statement.