added try-catch blocks (reduced size) and defined COOKIE_TIME
more try-catch!