added center calculation