Adding secret key.
Changing query into database.