modified some functions