Fix bug, now got the intended behavior without a timeout

The code is not as clean as I want to though
Remove comments