Made the functions private and switched away from the regex.