kind of merged with improved-type manually, made code cleaner