lots o fixes and cleanup and shennans