can't call class function with var name, switching to a case statement