moved helper funcs