changed time() to mktime()