added compare method for Code