Updated CommonFunctions.cs with various fixes and functions

*NOT TESTED* I haven't tested this at all, if you are going to merge it, please take a look too.
Removed unneeded variables, added accelerated pixel search by skipping, greatly re-written documentation.