Encorporates the margins correctly into resize functionality