Miscellaneous changes. Working on porting instead.