hopefully fixed timing issues using time() instead of clock()