More work on #1172, also fix a bunch of type information in various files to start getting rid of squiggles in idea from adding reference paths.