mostly cleanup, some fixes