refractory
improved speed

Worked on optimizing this function to improve its speed. Ended creating
a new version of it.
removed enums from namespace global

Removed them from global in order to prevent the need to have static
memory iniatialization.
phase99 changed format

Changed format to go from if/elseif blocks to a switch statement.