BGP Origin Code Attribute explained

Why origin code is compared before MED? Any problem if the best path selection process compare MED first and then origin code?