Changed tables structure
Adapted main to new table structure