added debug via writeToFile
removed automatic segment request - now only requesting if needed
Added low-level debug function which writes message to file
removed old comment