private void rateLimit() {
        try {
            int delay = UPDATE_RATE - (int) (System.currentTimeMillis() - lastUpdate);
            if (delay > 0)

                Thread.sleep(delay);

            lastUpdate = System.currentTimeMillis();
        } catch (InterruptedException e) {
            // someone interrupted our thread, silently fail
        }
    }