first working version for single file