added logging, cleaned up temp folder creation