added new fucntions to solve some problems