added margin to center calculation