added some functions for js