improved the observe function for better performance when resizing the browser window