API: Added Join to SQL queries,
     Added DEBUG mode