the first working version with time