Improved RE logic with () to consolidate code