Reduced the need for setTimeouts.