continued rewrite and cleanup - now resupport full app