Cleaned most of the checkstyle errors on complexity but this thing defin...

...itely needs to be rewritten
isn't this platform specific?