Changing from plain sql queries to GORM for better maintenance and stability Use of Models for database tables and added JSON objects Cleaned a bit the code and added some comments in the files