math cleanup