Added tempfile support, removed some debug things