Fixing database entry stuffs.
sql optimisation and fixing stored procedure code.