Fixed a fuckton of inconsistencies and errors. Some of the functions defined not yet implemented.