fixed the SQL issues. Fun times!