adjusted helper code