Minor changes to some functions and addition of a couple of functions