New utilities Flag.py and GetPrefix.py, also moved tests into a subdirectory