refactored every GATEWAY in macros to GW to work around line length limit
removed initialisation to 0 or NULL of static, removed space after * in pointers declaration
addressed line length, block comments, whitespace
more whitespace, * in pointer declarations
fixed all block comments to comply with guidelines
more line wrap, *, assignments in if, whitespace
extra ) removed