Switch to string and fn instead of regex