added an autoResize feature to accomodate changes in window size