improved documentation, some functions were renamed and removed unused or duplicated functions