switched to using time() instead of clock()