more comments + made some functions private