added timing attack protection
updated database connection