made some functions and fixed some part. also clarified some parts