added some functions. untested.