Hard-coded values to variable names and clean up

Stared to switch from hard-coded vales into variable names for the SQL
statements. Added API call comment headers for each SQL statement. Still
a work in progress