clean up, simplification, made windows version work again