Extracted preparsing code into a static public method