Fixed some typos, added a couple functions and some preprocessor directives