Large commit of misc modifications and improvements