redraws on resize, cleaned up code