removed unused image
fixed formatting, added comments and fixed various SQL statements