cleanup + some types fixed