wrote a bunch of code but need to fix up the SQL stuff