added auto center feature