-Added debugging messages
-Added hacky solution to resolve an infinite loop