Smarter margin removal