moved func to toplevel because ruby didn't find it