Added backticks to SQL queries to allow compatibility with PostgreeSQL