working version, still suffers from flutter, time implemented