Updated Search Function and added few database functions.