improved re-layouting on resize