added some functions and documentation