tweaked the high-level functions