tidy and construct better regex