changed margin calculation