Fixed the rest and added some new functions

I Fixed  some CPP files and added some functions to some classes.
I also added the definition of some functions.