improved some functions