At least simplifying this down to using `strings.HasPrefix`. This function is overly-complex.