dynamic margin
refactor