Appended coding styles, fixed SQL syntax and some comments