added some features and modified some functions