first cut of fix for proper subfunctions