Added autosize code