added timeout of 500ms to prevent a lot of repeated calls when resizing