Updated server to not hang after looping.