make some functions top level