file writing works
removed debug code