major functions commented