added in a couple of functions here (where they should have been in the first place anyway)