Misc additions. Mostly replacing non-existent subroutines.