Cleanup debug code, fix infinite loop >.<