Updated: margin calculator