Last adjusts. Refatoring of code and database